<%@page import="com.stx.model.RegisterCommentModel"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="org.apache.catalina.Session"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="com.stx.model.RegisterBlogModel"%>
<%@page import="com.stx.sql.SqlQuery"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<link href="css/css.css" rel="stylesheet" type="text/css">
<script src="lib/jquery.js" type="text/javascript"></script>
<script src="lib/jquery.validate.js" type="text/javascript"></script>
<script src="localization/messages_cn.js" charset="UTF-8"
	type="text/javascript"></script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>五人行博客</title>
</head>
<body>
<img src="img/22.jpg" id="bgimage"/>
<div id="menu" class="transparent_class">
<span id="menuleft"><a href="welcome.jsp"><%=session.getAttribute("username") %></a>已登录</span>

<span id="menuright"><a href="login.jsp">退出</a>|<a href="register2.html">注册</a></span>
</div>
<div id="bgtop" class="transparent_class"><h1><a href='welcome.jsp'><<返回欢迎页面</a>评论博文</h1></div>
	<div id="center" class="transparent_class">
		
		<div id="writecomment" >
			<ul id="blog1">
				<%
					SqlQuery sqlQuery = new SqlQuery();
					RegisterBlogModel registerBlogModel = new RegisterBlogModel();
					registerBlogModel.setB_id(request.getParameter("b_id"));
					ResultSet rs = sqlQuery.rereadBlogSql(registerBlogModel);
					String result = null;
				%>
				<%
					while (rs.next()) {
				%>
				<li>
					<ul id="blog2">
						<li>
						<div id="timeleft">博文题目：<%=rs.getString("title")%></div>
						<div id="timeright">博文分类：<%=rs.getString("blogtype")%></div></li>
						<li id="blogcontent3"><%=rs.getString("blogcontent")%></li>
						<li id="timepage">
							<div id="timeleft">
								用户ID：<%=rs.getString("u_id")%></div>
							<div id="timeright">
								博文更新时间<%=rs.getString("timepage")%></div>
						</li>

					</ul>
				</li>
				<%
					}
				%>
			</ul>
			<div id="hang1">
			<hr ></div>
		</div>
		<div id="comment3">
			<ul id="blog1">
				<%
					SqlQuery sqlQuery2 = new SqlQuery();
					RegisterCommentModel registerCommentModel = new RegisterCommentModel();
					registerCommentModel.setB_id(request.getParameter("b_id"));
					ResultSet rs2 = sqlQuery2.readCommentSql(registerCommentModel);
				%>
				<%
					String result2 = "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;评论 </h1><br><br>";
					result2 += "<script src='blog.js'></script>";
					result2 += "<div id='readblog'>";
					while (rs2.next()) {
				%>
				<li>
					<ul id="onecomment">
						<li id="blogcontent4">							
							
								<%=rs2.getString("p_id")%>楼
						</li>
						<li id="neirong">评论内容：<%=rs2.getString("commentContent")%></li>
						<li id="timepage">
							<div id="timeleft">
								用户ID：<%=rs2.getString("u_id")%></div>
							<div id="timeright">
								评论时间<%=rs2.getString("createtime")%></div>
						</li>
			<div id="hang">
			<hr >
			</div>
					</ul>
				</li>
				<%
					}
				%>
			</ul>
		</div>
		<div>
			<form action="WriteCommentServlet" method="post" id="myform">
				
				<p><input type="hidden" id="b_id" name="b_id" value="<%=registerBlogModel.getB_id()%>"/>
					<input type="hidden" id="username" name="username" value="<%=(String)session.getAttribute("username")%>"/>
					正文<br /> 
					<textarea id="commentContent" name="commentContent" cols="60"
						rows="10">
</textarea>
					<br />
				<p>
					<br> <input type="submit" value="提交">
			</form>

		</div>


	</div>
<div id="friends"  class="transparent_class">
<br><br>好友：<br>
<%

rs=sqlQuery.getAllUserSql();
while(rs.next()){
	
	

%>
<hr>
<a href="readblog.jsp?username=<%=rs.getString("username") %>"><h3><%= rs.getString("username") %> </h3></a>
<%} %>
</div>
</body>
</html>

